package com.xlobo.api.charge.testcase;

import java.math.BigDecimal;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.xlobo.api.charge.parameter.CalculateOutStoreFeeBean;
import com.xlobo.api.charge.service.CalculateOutStoreFeeCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.common.enums.PackageTypeEnum;

/**
 * 计算FBX出库费用接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_CalculateOutStoreFee {
	private static CalculateOutStoreFeeBean calculateOutStoreFeeBean;
	private static CalculateOutStoreFeeCall calculateOutStoreFeeCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("计算FBX出库费用接口");
	}

	@Before
	public void caseUp() {
		calculateOutStoreFeeBean = new CalculateOutStoreFeeBean();
		calculateOutStoreFeeCall = new CalculateOutStoreFeeCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(calculateOutStoreFeeCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CalculateOutStoreFee_001() {
		Logger.start(true,"获取FBX出库费用成功");
		try {
			calculateOutStoreFeeBean.setLogisticId(1);
			calculateOutStoreFeeBean.setChargeLevel(1);
			calculateOutStoreFeeBean.setWeight(new BigDecimal(10));
			calculateOutStoreFeeBean.setPackingType(PackageTypeEnum.简易打包.getValue());
			calculateOutStoreFeeBean.setInsure(new BigDecimal(20));
			calculateOutStoreFeeCall.setData(calculateOutStoreFeeBean);
			calculateOutStoreFeeCall.callService();
			Logger.comment("calculateOutStoreFeeCall send:" + calculateOutStoreFeeCall.getEntityString());
			Logger.comment("calculateOutStoreFeeCall response:" + calculateOutStoreFeeCall.getReturnData());
			Logger.verifyEquals("true", calculateOutStoreFeeCall.getMsg(), "验证卖家ID与传入是否一致");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}